<template>
  <div>
    <div class="swiper">
      <div class="swiper-wrapper">
        <slot></slot>
      </div>
      <!-- 如果需要分页器 -->
      <div class="swiper-pagination"></div>
    </div>
  </div>
</template>
<script>
import Swiper from 'swiper/bundle'
import 'swiper/css/bundle'
export default {
  props: {
    loop: {
      type: Boolean,
      default: true
    }
  },
  mounted () {
    new Swiper('.swiper', {
      // direction: 'vertical', // 垂直切换选项
      loop: this.loop, // 循环模式选项

      // 如果需要分页器
      pagination: {
        el: '.swiper-pagination'
      },
      // 自动轮播
      autoplay: {
        delay: 2500,
        disableOnInteraction: false
      }
    })
  }
}
</script>
